package com.pluser.mq.vo;

import java.io.Serializable;

/**
 * 
 * QueueInfo class
 * @author pluser
 * @version 1.0
 * @date 2014-05-03
 * @modifiedHis
 *
 * @description
 * includes name and open option of queue
 */
public class QueueInfo implements Serializable {

	private static final long serialVersionUID = -6792280149601726018L;
	
	private String name;
	private int openOptions;
	
	/**
	 * constructor
	 * @param name name of queue
	 * @throws IllegalArgumentException if name is null or empty
	 */
	public QueueInfo(String name) throws IllegalArgumentException {
		
		if(name == null || name.trim().length() == 0) {
			throw new IllegalArgumentException("queue's name is null or empty");
		}
		
		this.name = name;
		this.openOptions = -1;
	}
	
	/**
	 * constructor
	 * @param name name of queue
	 * @param openOptions queue's open option that is MQConstants.MQOO_.*,
	 * for example MQOO_OUTPUT | MQOO_FAIL_IF_QUIESCING
	 * @throws IllegalArgumentException if name is null or empty
	 */
	public QueueInfo(String name, int openOptions)
			throws IllegalArgumentException {
		
		if(name == null || name.trim().length() == 0) {
			throw new IllegalArgumentException("queue's name is null or empty");
		}
		
		this.name = name;
		this.openOptions = openOptions;
	}

	/**
	 * 
	 * @return name of queue
	 */
	public String getName() {
		return name;
	}

	/**
	 * 
	 * @param name queue's name
	 * @throws IllegalArgumentException if name is null or empty
	 */
	public void setName(String name) throws IllegalArgumentException {
		
		if(name == null || name.trim().length() == 0) {
			throw new IllegalArgumentException("queue's name is null or empty");
		}
		
		this.name = name;
	}

	/**
	 * 
	 * @return open options of queue
	 */
	public int getOpenOptions() {
		return openOptions;
	}

	/**
	 * 
	 * @param openOptions queue's open options
	 */
	public void setOpenOptions(int openOptions) {
		this.openOptions = openOptions;
	}
	
}
